/* ========================================================= Liga Tocho CDMX A.C. — Landing Edita CONFIG, EVENTOS y TESTIMONIOS para actualizar el sitio. ========================================================= */ const CONFIG = { // Número de WhatsApp con lada de país, solo dígitos (ej. 5215512345678) whatsapp: "5547853172", telefonoTexto: "WhatsApp: 55-4785-3172", email: "ligatochocdmx@gmail.com", direccion: "Deportivo Hermanos Galeana, Ciudad de México.", horarios: "Fines de semana. Horarios por categoría según el rol de juegos.", comoLlegar: "Accesible en transporte público y con estacionamiento en el deportivo. Usa el botón de Google Maps para trazar tu ruta.", redes: { instagram: "https://www.instagram.com/explore/locations/1001726073203010/liga-tocho-cdmx/", facebook: "https://www.facebook.com/ligatochocdmx", youtube: "https://www.youtube.com/channel/UCmIyKOKVZJheesGdtoTWBLA", tiktok: "https://www.tiktok.com/@ligatochocdmx", }, }; // Fechas clave de la temporada. fecha: "AAAA-MM-DD" o null si está por confirmar. // estado: "open" (verde), "hot" (rojo) o "" (neutro). const EVENTOS = [ { fecha: null, titulo: "Inscripciones abiertas", detalle: "Registro de equipos para todas las categorías.", estado: "open", etiqueta: "Abiertas", }, { fecha: null, titulo: "Junta de capitanes", detalle: "Reglamento, rol de juegos y entrega de documentación.", estado: "", etiqueta: "Por confirmar", }, { fecha: null, titulo: "Jornada inaugural", detalle: "Arranque de temporada · Deportivo Hermanos Galeana.", estado: "hot", etiqueta: "Próximamente", }, { fecha: null, titulo: "Playoffs y finales", detalle: "Eliminatorias y premiación por categoría.", estado: "", etiqueta: "Por confirmar", }, ]; // Testimonios reales de jugadores o coaches. Si queda vacío, el bloque se oculta. // Ejemplo: { texto: "…", nombre: "Nombre Apellido", rol: "Capitán · Varonil" } const TESTIMONIOS = []; /* ---------------------------------------------------------- */ document.documentElement.classList.remove("no-js"); const $ = (sel, ctx = document) => ctx.querySelector(sel); const $$ = (sel, ctx = document) => [...ctx.querySelectorAll(sel)]; const waLink = (msg) => `https://wa.me/${CONFIG.whatsapp}?text=${encodeURIComponent(msg)}`; // Datos de contacto y enlaces $$("[data-config]").forEach((el) => { const value = CONFIG[el.dataset.config]; if (value) el.textContent = value; }); $$("[data-whatsapp]").forEach((el) => { el.href = waLink(el.dataset.whatsapp); }); $$("[data-email]").forEach((el) => { el.href = `mailto:${CONFIG.email}`; }); $$("[data-social]").forEach((el) => { const url = CONFIG.redes[el.dataset.social]; if (url) el.href = url; }); const year = $("#year"); if (year) year.textContent = new Date().getFullYear(); // Header al hacer scroll const header = $("#header"); const onScroll = () => header.classList.toggle("is-scrolled", window.scrollY > 30); onScroll(); window.addEventListener("scroll", onScroll, { passive: true }); // Menú móvil const nav = $("#nav"); const toggle = $("#navToggle"); const setMenu = (open) => { nav.classList.toggle("is-open", open); toggle.setAttribute("aria-expanded", String(open)); toggle.setAttribute("aria-label", open ? "Cerrar menú" : "Abrir menú"); document.body.classList.toggle("nav-open", open); }; toggle.addEventListener("click", () => setMenu(!nav.classList.contains("is-open")), ); $$("a", nav).forEach((a) => a.addEventListener("click", () => setMenu(false))); document.addEventListener("keydown", (e) => { if (e.key === "Escape") setMenu(false); }); // Enlace activo según la sección visible const links = $$(".nav__link"); const sections = links.map((l) => $(l.getAttribute("href"))).filter(Boolean); const navObserver = new IntersectionObserver( (entries) => { entries.forEach((entry) => { if (!entry.isIntersecting) return; links.forEach((l) => l.classList.toggle( "is-active", l.getAttribute("href") === `#${entry.target.id}`, ), ); }); }, { rootMargin: "-45% 0px -50% 0px" }, ); sections.forEach((s) => navObserver.observe(s)); // Calendario const MESES = [ "Ene", "Feb", "Mar", "Abr", "May", "Jun", "Jul", "Ago", "Sep", "Oct", "Nov", "Dic", ]; const eventosEl = $("#eventos"); if (eventosEl) { eventosEl.innerHTML = EVENTOS.map((ev) => { let date = `
Porconfirmar
`; if (ev.fecha) { const [y, m, d] = ev.fecha.split("-").map(Number); date = `
${String(d).padStart(2, "0")}${MESES[m - 1]} ${String(y).slice(2)}
`; } const status = ev.etiqueta ? `${ev.etiqueta}` : ""; return `
  • ${date}

    ${ev.titulo}

    ${ev.detalle}

    ${status}
  • `; }).join(""); } // Testimonios if (TESTIMONIOS.length) { $("#testimoniosGrid").innerHTML = TESTIMONIOS.map( (t) => `
    ${t.texto}
    ${t.nombre}${t.rol}
    `, ).join(""); $("#testimonios").hidden = false; } // Animaciones al entrar en pantalla const revealObserver = new IntersectionObserver( (entries, obs) => { entries.forEach((entry) => { if (!entry.isIntersecting) return; entry.target.classList.add("is-visible"); obs.unobserve(entry.target); }); }, { threshold: 0.12, rootMargin: "0px 0px -40px 0px" }, ); $$(".reveal, .reveal-stagger").forEach((el) => revealObserver.observe(el)); // Formulario → WhatsApp const form = $("#signupForm"); const note = $("#formNote"); form.addEventListener("submit", (e) => { e.preventDefault(); let valid = true; ["nombre", "telefono", "categoria"].forEach((name) => { const input = form.elements[name]; const ok = input.checkValidity() && input.value.trim() !== ""; input.closest(".field").classList.toggle("is-invalid", !ok); if (!ok) valid = false; }); const privacidad = form.elements.privacidad; privacidad .closest(".check") .classList.toggle("is-invalid", !privacidad.checked); if (!privacidad.checked) valid = false; if (!valid) { note.textContent = "Revisa los campos marcados y acepta el aviso de privacidad."; note.className = "form__note is-error"; return; } const d = Object.fromEntries(new FormData(form)); const msg = [ "Hola, quiero información para inscribirme en la Liga Tocho CDMX.", `Nombre: ${d.nombre}`, `Teléfono: ${d.telefono}`, d.equipo ? `Equipo: ${d.equipo}` : "", `Categoría: ${d.categoria}`, d.mensaje ? `Mensaje: ${d.mensaje}` : "", ] .filter(Boolean) .join("\n"); window.open(waLink(msg), "_blank", "noopener"); note.textContent = "¡Gracias! Se abrió WhatsApp con tu solicitud. Solo presiona enviar."; note.className = "form__note is-ok"; if (typeof gtag === "function") gtag("event", "generate_lead", { categoria: d.categoria }); form.reset(); }); form.addEventListener("input", (e) => { const field = e.target.closest(".field, .check"); if (field) field.classList.remove("is-invalid"); });